package edu.stanford.prpl.api.xmlrpc;

import java.util.List;
import java.util.Map;

import edu.stanford.prpl.api.Device;

/**
 * PCM server implements ResourceManager,BlobManager, IdentityManger, GroupManager DeviceMethod, IndexMethod as
 * PRPLAppAPI. PCMSeverXmlRpc overrides non standard XML-RPC compatible calls with compatible calls.
 */

public interface PCMServerXmlRpc {

	// Index
	double getIndexLastModifiedDate();

	// Identity
	String[] getAllIdentities();

	String[] getAllGroupsForIdentity(String identityURI);

	String getIdentityByURI(String identityURI, boolean create);

	String getIdentityByKey(String key);

	// Resource
	String createBlobResource();

	String createBlobResource(String deviceURI);

	String createResource();

	String[] getAllGroupsSharing(String resourceURI);

	String[] getAllIdentitiesSharing(String resourceURI);

	List<String> getAllResources();

	List<String> getAllBlobResources();

	List<String> getAllResourcesByPropertyValue(String propertyURI, Object[] valuePair);

	List<String> getAllResourcesFrom(String identityURI);

	List<String> getAllResourcesSharedWithGroup(String groupURI);

	List<String> getAllResourcesSharedWithIdentity(String identityURI);

	String getResource(String resourceURI);

	String getResourceOwner(String resourceURI);

	boolean shareResourceWithGroups(String resourceURI, Object... groupURIs);

	boolean shareResourceWithIdentities(String resourceURI, Object... identityURIs);

	boolean unshareResourceWithGroups(String resourceURI, Object... groupURIs);

	boolean unshareResourceWithIdentities(String resourceURI, Object... identityURIs);

	// Meta
	boolean addResourceTags(String resourceURI, Object... values);

	boolean removeResourceTags(String resourceURI, Object... values);

	List<String[]> getResourceMetaData(String resourceURI, String propertyURI);

	boolean addResourceMetaData(String resourceURI, String propertyURI, Object[] values);

	boolean removeResourceMetaData(String resourceURI, String propertyURI, Object[] values);

	boolean setResourceMetaData(String resourceURI, String propertyURI, Object[] values);

	double getResourceBlobSize(String resourceURI);

	boolean setResourceBlobSize(String resourceURI, double size);

	double getResourceBlobLastModifiedDate(String resourceURI);

	boolean setResourceBlobLastModifiedDate(String resourceURI, double date);

	double getResourceMetaLastModifiedDate(String resourceURI);

	boolean setResourceMetaLastModifiedDate(String resourceURI, double date);

	Map<String, String> getResourceBlobServerDevice(String resourceURI);

	// List<String> getAllBlobResourcesByBlobSourceURI(String sourceURI);

	// Group
	String createGroup(String groupName);

	String getGroupByName(String groupName);

	String getGroupByURI(String groupURI);

	String getPublicGroup();

	String[] getAllGroupMembers(String groupURI);

	String[] getAllGroups();

	// Query
	List<Map<String, ?>> runQuery(String query);

	List<Map<String, ?>> runQuery(String query, Map initialBinding);

	// Device
	List<Map<String, String>> getAllDevices();

	List<Map<String, String>> getAllBlobServerDevices();

	Map<String, String> getDevice(String deviceURI);
}
